--- 战策一·金鼓齐鸣
local policy1 = fk.CreateSkill {
    name = "drum_together",
    tags = { Skill.Compulsory },
    dynamic_name = function (self, player, lang)
      return player == Self and self.name or "unknownpolicy"
    end,
    dynamic_desc = function (self, player, lang)
      return player == Self and self.name or "unknownpolicy"
    end,
}

local HG = require "packages/new_heg_diy_my/util"

Fk:loadTranslationTable{
    ["@[drum_together_mark]"] = "金鼓齐鸣",
    ["drum_together_ask"] = "战策-金鼓齐鸣：你可以令所有与你势力相同的角色各摸一张牌",
}

local H = require "packages/ol_hegemony/util"

policy1:addEffect(fk.Damage, {
    anim_type = "drawcard",
    can_trigger = function(self, event, target, player, data)
        local mark_name = "@[private]" .. policy1.name .. "_mark"
        return player:getMark(mark_name) ~= 0 and target == player
    end,
    on_cost = function(self, event, target, player, data)
        return player.room:askToSkillInvoke(player, { skill_name = "unknownpolicy", prompt = "drum_together_ask" })
    end,
    on_use = function(self, event, target, player, data)
        local mark_name = "@[private]" .. policy1.name .. "_mark"
        local room = player.room
        for _, p in ipairs(room.alive_players) do
            if H.compareKingdomWith(p, player) and not p.dead then
                p:drawCards(1, policy1.name)
            end
        end
        room:setPlayerMark(player, mark_name, 0)
        room:handleAddLoseSkills(player, "-drum_together", nil, false)
        room.logic:trigger(HG.HegLosePolicy, player, { player, policy1.name })
    end,
})

return policy1
